package com.molin.StreamTest;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Stream;

public class Demo4 {
    public static void main(String[] args) {
        ArrayList<String> nameList = new ArrayList<>(List.of("张三丰", "张无忌", "谢敏", "张良", "王二麻子", "张隆基", "张隆基", "张隆基", "张隆基"));
        nameList.stream().limit(3).forEach(s-> System.out.println(s));
       nameList.stream().skip(3).forEach(s-> System.out.println(s));
        ArrayList<String> nameList2 = new ArrayList<>(List.of("张三丰", "张无忌", "谢敏", "张良", "王二麻子", "张隆基"));
        Stream<String> stringStream1 = nameList.stream();
        Stream<String> stringStream2 = nameList2.stream();
        Stream.concat(stringStream1, stringStream2).forEach(s -> System.out.println(s));
        nameList.stream().distinct().forEach(s-> System.out.println(s));
    }

}
